(provide 'wangpeng)

;; package manager
(require 'package)
(add-to-list 'package-archives 
	     '("marmalade" .
	       "http://marmalade-repo.org/packages/"))
(package-initialize)

;;; bind RET to py-newline-and-indent
(add-hook 'python-mode-hook '(lambda () 
			       (define-key python-mode-map "\C-m" 'newline-and-indent)))

(add-hook 'agda2-mode-hook '(lambda () 
			      (define-key agda2-mode-map "\C-m" 'newline-and-indent)))

(add-hook 'go-mode-hook
	  (lambda ()
	    (setq indent-tabs-mode t)
	    (setq tab-width 4)))

(global-set-key "\C-x\C-m" 'compile)

(require 'rainbow-delimiters)
(global-rainbow-delimiters-mode)
(add-hook 'emacs-lisp-mode-hook 'rainbow-mode)

(setq auto-mode-alist (cons '("\\.d$" . d-mode) auto-mode-alist))

(defun revert-all-buffers ()
  "Refreshes all open buffers from their respective files."
  (interactive)
  (dolist (buf (buffer-list))
    (with-current-buffer buf
      (when (and (buffer-file-name) (file-exists-p (buffer-file-name)) (not (buffer-modified-p)))
	(revert-buffer t t t) )))
  (message "Refreshed open files.") )
